import time
w = open('m1_sorted.txt', 'r')
w1 = open('m2_reverse.txt', 'r')
w2 = open('m3_shuffle.txt', 'r')

w = w.read().split()
w = [int(i) for i in w]
w1 = w1.read().split()
w1 = [int(i) for i in w1]
w2 = w2.read().split()
w2 = [int(i) for i in w2]
def puzir(s):
    for j in range(1, len(s)):
        for i in range(len(s)-j):
            if s[i] > s[i+1]:
                s[i], s[i + 1] = s[i+1], s[i]
    return s
v = time.time()
puzir(w)
vv = time.time()
v1 = time.time()
puzir(w1)
vv1 = time.time()
v2 = time.time()
puzir(w2)
vv2 = time.time()
print('m1_sorted.txt', round((vv-v)*1000), 'milliseconds')
print('m2_reverse.txt', round((vv1-v1)*1000), 'milliseconds')
print('m3_shuffle.txt', round((vv2-v2)*1000), 'milliseconds')
